<template>
	<view class="u-p-20">
		<view class="u-p-20 u-text-right u-flex u-row-right">
			<view class="u-font-28  u-weight" @click="$u.route('/subcontract/mybag/massage/massage')"> 提现记录
			</view>
			<view class="u-m-l-20 u-font-28 u-weight" @click="$u.route('/subcontract/withdrawAccount/withdrawAccount')"> 提现设置
			</view>
		</view>
		
		<!-- 充值方式 -->
			<view v-if="applyList" class="u-p-20">
					<view class="u-text-center">-提现方式-</view>
					<view v-if="applyList[0] && applyList[0].status=='1'" class="u-flex u-row-between u-p-20 u-m-t-20" style="border-bottom: 1rpx solid #F6F6F6FF;">
						<view class="">
							<view class=" u-flex">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/wx.png" mode="aspectFill" width="70rpx" height='70rpx'>
								</u-image>
								<view class="u-m-l-20 u-font-28 ">微信</view>
							</view>
						</view>
						<view class="u-flex">
							<view class="" @click="pays='wx'">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="40rpx" height='40rpx'
									v-if="pays=='wx'"></u-image>
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="40rpx" height='40rpx' v-else>
								</u-image>
							</view>
						</view>
					</view>
					<view v-if="applyList[1] && applyList[1].status=='1'" class="u-flex u-row-between u-p-20" style="border-bottom: 1rpx solid #F6F6F6FF;">
						<view class="">
							<view class=" u-flex">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/zf.png" mode="aspectFill" width="70rpx" height='70rpx'>
								</u-image>
								<view class="u-m-l-20 u-font-28">支付宝</view>
							</view>
				
						</view>
						<view class="u-flex">
							<view class="" @click="pays='zfb'">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="40rpx" height='40rpx'
									v-if="pays=='zfb'"></u-image>
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="40rpx" height='40rpx' v-else>
								</u-image>
							</view>
						</view>
					</view>
					<view v-if="applyList[2] && applyList[2].status=='1'" class="u-flex u-row-between u-p-20" style="border-bottom: 1rpx solid #F6F6F6FF;">
						<view class="">
							<view class=" u-flex">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/bank.png" mode="aspectFill" width="70rpx" height='70rpx'>
								</u-image>
								<view class="u-m-l-20 u-font-28">银行卡</view>
							</view>
									
						</view>
						<view class="u-flex">
							<view class="" @click="pays='bank'">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="40rpx" height='40rpx'
									v-if="pays=='bank'"></u-image>
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="40rpx" height='40rpx' v-else>
								</u-image>
							</view>
						</view>
					</view>
			</view>
		
		
		<view class="u-p-20" >
			<u-field v-model="params.amount" label="提现金额" placeholder="请输入提现金额">
			</u-field>
		</view>
		<view class="u-w-750 u-p-20 bg_FFFFFF">
			<view class="" style="overflow-x: hidden;">
				<u-parse
					:html="ruleHtml"></u-parse>
			</view>
		</view>
		<view @click="save" class="u-w-650 u-m-t-50 u-auto u-h-100 u-l-h-100 u-text-center  u-b-r-13 cl_FFF" style="background: linear-gradient(-64deg, #FF382C, #FF633F);">提交</view>
		
		
		<u-toast ref="uToast" />
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				params:{
					amount:'',
					method:'',
				},
				pays:'wx',
				applyList:[],
				ruleHtml:''
			}
		},
		onShow() {
			this.apply_list()
			this.getWithdrawRule()
		},
		methods: {
			getWithdrawRule(){
				this.$api.getWithdrawRule({}, res => {
					if(res.data.code==1){
						this.ruleHtml = res.data.data.rule
						console.log(this.ruleHtml )
					}
				})
			},
			apply_list(){
				this.$api.apply_list({}, res => {
					if(res.data.code==1){
						this.applyList=res.data.data
						console.log(this.applyList)
					}
				})
			},
			save(){
				if(this.params.amount==''){
					this.$refs.uToast.show({
						title:'请输入提现金额',
						type: 'error'
					})
					return
				}
				if(this.params.amount<=0){
					this.$refs.uToast.show({
						title:'请输入大于0的提现金额',
						type: 'error'
					})
					return
				}
				this.params.method=this.pays=='wx'?'wechat':this.pays=='zfb'?'alipay':'bank'
				this.$api.save_money(this.params, res => {
					if (res.data.code == 1) {
						this.$refs.uToast.show({
							title: res.data.msg,
							type: 'success',
							callback: cal => {
								uni.switchTab({
									url:'/pages/my/my'
								})
							}
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
